import mysql.connector

config = {
    'user':'root',
    'password':'root',
    'host':'localhost',
    'database':'test'}

cnx = mysql.connector.connect(**config)
cursor=cnx.cursor()
cursor.execute('show tables;')
for (name) in cursor:
    print(name)
cnx.close()

